package com.nervenets.web.controller.handler.admin.setting;

import com.nervenets.web.controller.handler.Handler;
import com.nervenets.web.hibernate.domain.setting.Tags;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

public class TagListHandler extends Handler<TagListParams> {

    @Override
    public String handle(TagListParams params, HttpServletRequest request) throws Exception {
        String hql = "from Tags where tagType = ? order by queue desc";
        List<Object> objects = new ArrayList<>();
        objects.add(params.getTagType());
        List<Tags> list = userDao.getAllObjectsByHql(hql, objects);
        return successMessage(list);
    }

    @Override
    public String result() throws Exception {
        return successMessage();
    }
}
